#include "taskform.h"
#include "ui_taskform.h"
#include <QDate>

taskform::taskform(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::taskform)
{
    ui->setupUi(this);
}

taskform::~taskform()
{
    delete ui;
}

void taskform::settaskinfo(QString task_name,QString end_date)
{
    ui->label->setText(task_name);
    ui->label_2->setText(end_date);
    QDate currentDate = QDate::currentDate();
    QDate endDate = QDate::fromString(end_date, "yyyy-MM-dd");
    int dayLength = endDate.daysTo(currentDate);

    if(dayLength<0){
        QString l3=QString::number(-dayLength);
        ui->label_3->setText(l3);
    }
    else{
        QString l3=QString::number(-dayLength);
        ui->label_3->setText(l3);
    }
}
